import request from '../request'

/**
 * 评论/回复评论
 * @param {int} videoId 视频id
 * @param {int} parentId 父级id
 * @param {string} content 评论内容
 * @returns 
 */
export const apiAddcomment = (videoId,parentId,content) => {
    return request.post(`/comment`,{
        params: {
            videoId,
            parentId,
            content
        }
    })
}

/**
 * 获取视频下的评论
 * @param {int} videoId 视频id
 * @param {int} page 当前页
 * @param {int} limit 条数
 * @returns 
 */
export const apiGetComment = (videoId, page=1,limit=10)=>{
    return request.get(`/comment/by/video/${videoId}`,{
        params: {
            page,
            limit
        }
    })
}

/**
 * 获取根评论下的子评论
 * @param {int} rootId 根评论id
 * @param {int} page 当前页
 * @param {int} limit 条数
 * @returns 
 */
export const apiGetChildComment = (rootId,page=1,limit=10) => {
    return request.get(`/comment/by/rootComment`,{
        params: {
            page,
            limit,
            rootId
        }
    })
}

/**
 * 删除评论
 * @param {int} commentId 评论id
 * @returns 
 */
export const apiDeleteComment = (commentId) => {
    return request.delete(`/comment/${commentId}`)
}

/**
 * 点赞/取消点赞
 * @param {int} commentId 评论id
 * @returns 
 */
export const apiThumbUpComment = (commentId) =>{
    return request.post(`/comment/${commentId}`)
}